\chapter{From Logical Time to Physical Time}

\section{Question 3 Modify your algorithm from logical time to physical time}

Posons les variables globales du système

\begin{itemize}
\item  \verb+GlobalClock+ : Horloge globale du système.
\end{itemize}


Redéfinissions la procédure \verb+CO_Brodcast+ : \ref{algo:broad}.

\begin{algorithm}
\caption{\textbf{COBroadcast}()}
/* \textit{ Avec horloge globale */}
\label{algo:broad}
\begin{algorithmic}[1]
\STATE Broadcast(m,cb)
\STATE S\_n $\leftarrow$ GC.clock
\STATE cb $\leftarrow $ \{(sn, i\}
\end{algorithmic}
\end{algorithm}



\begin{algorithm}
\caption{\textbf{CO\_Receive}(Message m)}
/* \textit{ Avec horloge globale */}
\label{algo:q3}
\begin{algorithmic}[1]
  \IF{ $\forall$ p$\in$ m.cb $\mid$ p.sn $\leq$ del(p.i)}
   \STATE  del(m.i) $\leftarrow$ m.sn
   \STATE  CO\_Deliver(m)
   \FORALL{ m\'~ $\in$ ListMessages}
   \STATE   CO\_Receive2(m')
   \ENDFOR
   \ELSE
   \STATE ListMessages.add(m)
  \ENDIF  
\end{algorithmic}
\end{algorithm}


\begin{algorithm}
\caption{\textbf{CO\_Receive2}(Message m)}
/* \textit{ Avec horloge globale */}
\label{algo:receive2}
\begin{algorithmic}[1]
  \IF{ $\forall$ p$\in$ m.cb $\mid$ p.sn $\leq$ del(p.i)}
   \STATE  del(m.i) $\leftarrow$ m.sn
   \STATE  CO\_Deliver(m)
   \STATE ListMessages.delete(m)
   \FORALL{ m' $\in$ ListMessages}
   \STATE CO\_Receive2(m)
   \ENDFOR
  \ENDIF  
\end{algorithmic}
\end{algorithm}

% LocalWords:  From Logical Time to Physical Modify your algorithm CO
% LocalWords:  from logical time physical GlobalClock Brodcast cb sn
% LocalWords:  Broadcast GC.clock Receive m.cb p.sn del p.i m.i m.sn
% LocalWords:  Deliver ListMessages aa ListMessages.add aaa
% LocalWords:  ListMessages.delete
